﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ClassLibrary.DAO;
using ClassLibrary.Entity;

public partial class Admin_ucControl_ucNoi : System.Web.UI.UserControl
{
    TblTypeNoidungDAO typeNoiDungDAO = new TblTypeNoidungDAO(Global.CONNECTION_STRING);
    TblNoiDungDAO noidungDAO = new TblNoiDungDAO(Global.CONNECTION_STRING);

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadTypeNoiDung();
        }
    }

    private void LoadTypeNoiDung()
    {
        drType.DataSource = typeNoiDungDAO.GetTypeNoiDung();
        drType.DataTextField = "TypeNoiDungName";
        drType.DataValueField = "ItemTypeNoiDung";
        drType.DataBind();
   
    }
    protected void btAdd_Click(object sender, EventArgs e)
    {
        string id = Request.QueryString["id"];
        TblNoidung noidung = new TblNoidung();
        noidung.ItemTypeNoiDung = Convert.ToInt32(drType.SelectedValue);
        noidung.NoiDungDescription = FCKeditor1.Value;
        noidung.Title = txtTitle.Text;

        noidung.IDNoiDung = 0;
        noidungDAO.InsUpdItem(noidung, 1);

    }
    protected void btnReset_Click(object sender, EventArgs e)
    {

    }
}
